﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WorkFlowBLL;

namespace QLCF.Forms.Reports
{
    public partial class frmViewReportStock : Form
    {       
        
        private int CateID=-1;
        private string CateName = "Tất cả";
        public frmViewReportStock()
        {
            InitializeComponent();
        }
        public frmViewReportStock(int m_cateID,string m_cateName)
        {
            InitializeComponent();
            
            CateID= m_cateID;
            CateName=m_cateName;
            
        }
       
        private void frmViewReportStock_Load(object sender, EventArgs e)
        {
            string strRPSource = string.Empty;
            CtrBase ctrp = new CtrBase();
            
            var items = ctrp.GetAllReportStockSearch("",CateID);
            reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
            reportViewer1.LocalReport.ReportEmbeddedResource = "QLCF.Reports.rptStock.rdlc";

            reportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter("prmCategoryName", "Danh mục: " + CateName));      

            reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("StockTable", items));
            reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.PageWidth;
            reportViewer1.ZoomPercent = 100;
            reportViewer1.RefreshReport();
        }
    }
}
